/**
*	CommonDefines.h
*
*	@brief This file includes library files, stl files and defines preprocessor macros
*
*	@author William McVicar
*/

#ifndef __COMMON_DEFINES_H_INCLUDED__
#define __COMMON_DEFINES_H_INCLUDED__

#if defined( WIN32 ) || defined( WIN64 )
#define PROTEIN_PLATFORM_WINDOWS 1

#ifdef _MSC_VER
    #if _MSC_VER == 1500
        #define PROTEIN_MSVC_VERSION "vc2008"
    #elif _MSC_VER == 1600
        #define PROTEIN_MSVC_VERSION "vc2010"
    #elif _MSC_VER == 1700
        #define PROTEIN_MSVC_VERSION "vc2012"
    #else
        #error Unknown or unsupported Visual C++ version
    #endif

    #ifdef _DEBUG
        #define PROTEIN_STATIC_LIBRARY_DEPENDENCY_SUFFIX PROTEIN_MSVC_VERSION "_d.lib"
    #else
        #define PROTEIN_STATIC_LIBRARY_DEPENDENCY_SUFFIX PROTEIN_MSVC_VERSION ".lib"
    #endif

    // Check that the statically linked multithreaded runtime is being used
    #if defined(_DLL) || !defined(_MT)
        #error The statically linked multithreaded runtime must be used, compile with either /MT or /MTd
    #endif

    #define _CRT_SECURE_NO_WARNINGS
#else
    #error Compiler not supported on this platform
#endif

#endif

//	Library Includes
#ifdef PROTEIN_PLATFORM_WINDOWS
#pragma comment( lib, "winmm" )
#endif

//  Standard Includes
#include <math.h>
#include <stdlib.h>
#include <algorithm>
#include <new>

//	STL Includes
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <queue>

//  Assert
#include <cassert>

//	Platform Includes
#if defined( PROTEIN_PLATFORM_WINDOWS )

	#ifndef WIN32_LEAN_AND_MEAN
	  #define WIN32_LEAN_AND_MEAN
	#endif

	#ifndef NOMINMAX
	  #define NOMINMAX
	#endif

	#include <windows.h>
	#pragma warning( disable : 4201 )
	#include <mmsystem.h>
	#include <tchar.h>
	#define inline __forceinline 
	#pragma warning( disable : 4996 )
	#define PROTEIN_MAX_PATH MAX_PATH
  #define PROTEIN_INLINE __forceinline

  #ifdef PROTEIN_USE_SIMD
    #include <xmmintrin.h>
  #endif

#elif defined( PROTEIN_PLATFORM_IOS )
	#define inline __inline__	
	#define PROTEIN_MAX_PATH 260
#endif

#define PROTEIN_UNUSED( x ) (void)x

typedef char			          c8;
typedef wchar_t			        c16;
typedef unsigned char	      u8;
typedef unsigned char	      byte;
typedef short			          i16;
typedef unsigned short      u16;
typedef int				          i32;
typedef unsigned int	      u32;
typedef float			          f32;
typedef double			        f64;
#if defined( PROTEIN_PLATFORM_WINDOWS )
  typedef __int64		        i64;
  typedef unsigned __int64  u64;
#ifdef PROTEIN_USE_SIMD
  typedef __m128            f128;
  typedef __m256            f256;
#endif
#elif defined( PROTEIN_PLATFORM_IOS )
  typedef int64_t		  i64;
  typedef uint64_t		u64;
#endif

#define PROTEIN_ALIGN( X ) __declspec( align( X ) )
#define PROTEIN_ALIGN16 PROTEIN_ALIGN(16)
#define PROTEIN_ALIGN32 PROTEIN_ALIGN(32)

#endif //__COMMON_DEFINES_H_INCLUDED__